package com.example.springssm.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class Knife4jConfig {

    @Bean
    public OpenAPI customOpenAPI() {
        return new OpenAPI()
                .info(new Info()
                        .title("员工管理系统API文档")
                        .version("1.0")
                        .description("基于SpringBoot+MyBatis的员工信息CRUD接口文档")
                        .license(new License().name("Apache 2.0")));
    }

    @Bean
    public GroupedOpenApi employeeApi() {
        return GroupedOpenApi.builder()
                .group("员工管理")
                .packagesToScan("com.example.employee.controller") // 指定Controller包
                .pathsToMatch("/api/employees/**") // 匹配接口路径
                .build();
    }
}